<pre class="docs-method-signature"><code>linkView.addVertex(x, y)</code></pre>
<p>Add a new <a href="#dia.Link.prototype.vertex">default vertex</a> to the link at the coordinates provided, and let the linkView automatically determine the index of the new vertex in the vertices array. If you need to add the vertex at a custom index, use the <code>link.addVertex()</code> <a href="#dia.Link.prototype.addVertex">function</a> instead.</p>

<p>This method uses the <code>linkView.getVertexIndex()</code> <a href="#dia.LinkView.prototype.getVertexIndex">function</a> to determine the index of the new vertex in the <code>vertices</code> array. The linkView checks the distance of vertices in the <code>link.vertices</code> array from the beginning of path and compares it to the distance of the added vertex. The new vertex is inserted before the first farther vertex in the <code>vertices</code> array.

<p>This function is useful within custom <code>linkView</code> event listener definitions. The following example adds a new vertex on a double click event, instead of a pointerdown event (which is the default behavior):</p>

<pre><code>var CustomLinkView = joint.dia.LinkView.extend({
    pointerdblclick: function(evt, x, y) {
        this.addVertex(x, y);
    }
});

var paper = new joint.dia.Paper({
    // ...
    linkView: CustomLinkView,
    interactive: { vertexAdd: false } // disable default vertexAdd interaction
});</code></pre>
